package main

import "fmt"

// 范型，
func main() {
	m := map[int]string{1: "lxj", 2: "manman", 3: "trueman"}
	keys := MapKeys[int, string](m)
	fmt.Println(keys)
}

func MapKeys[K comparable, V any](m map[K]V) []K {
	ks := make([]K, 0, len(m))
	for k := range m {
		ks = append(ks, k)
	}
	return ks
}
